package com.zzy.demo.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zzy.demo.common.dto.Result;
import com.zzy.demo.model.Person;
import com.zzy.demo.service.PersonService;
/**
 * 
 * @author guokaige
 *
 */
@Controller
@RequestMapping("/register")
public class RegisterController {
	
	@Autowired
	PersonService  personService;
	
	@RequestMapping("/index")
	public String registerIndex() {
		return "register";
	}

	@RequestMapping("/action")
	@ResponseBody
	public Result<Person> register(Person person) {
		Person dbPerson = personService.addPerson(person);
		return Result.success(dbPerson);
	}

	
}
